#include "stone.h"
#include <stdlib.h>

Stone::Stone(b2World *world, b2Vec2 pos, float angle_in_radius, float density, float friction)
    :PolygonBody(world, b2_dynamicBody, stones[rand()%5], 8, pos, angle_in_radius, density, friction)
{

}

const b2Vec2 Stone::stone0[] = {
    b2Vec2(1, 3),
    b2Vec2(-1, 4),
    b2Vec2(-2, 3),
    b2Vec2(-4, 2),
    b2Vec2(-5, 0),
    b2Vec2(-3, -1),
    b2Vec2(0, -2),
    b2Vec2(1, 0),
};

const b2Vec2 Stone::stone1[] = {
    b2Vec2(-1, 4),
    b2Vec2(-3, 3),
    b2Vec2(-4, 1),
    b2Vec2(-3, -1),
    b2Vec2(-1, -2),
    b2Vec2(1, 0),
    b2Vec2(3, 1),
    b2Vec2(2, 3),
};

const b2Vec2 Stone::stone2[] = {
    b2Vec2(0, 3),
    b2Vec2(-1, 2),
    b2Vec2(-2, 1),
    b2Vec2(-2, 0),
    b2Vec2(0, -1),
    b2Vec2(1, -2),
    b2Vec2(2, 0),
    b2Vec2(1, 2),
};

const b2Vec2 Stone::stone3[] = {
    b2Vec2(0, 3),
    b2Vec2(-1.3, 2.43),
    b2Vec2(-3, 1),
    b2Vec2(-2, 0),
    b2Vec2(-1, -2),
    b2Vec2(1.04, -1.45),
    b2Vec2(2, 0),
    b2Vec2(2, 2),
};

const b2Vec2 Stone::stone4[] = {
    b2Vec2(0.8, 1.99),
    b2Vec2(-1.3, 2.43),
    b2Vec2(-0.94, 0.71),
    b2Vec2(-2, 0),
    b2Vec2(-1, -1),
    b2Vec2(0, -2),
    b2Vec2(1.52, -1.41),
    b2Vec2(1.98, 0.43),
};

const b2Vec2 *Stone::stones[] = {
    stone0, stone1, stone2, stone3, stone4
};
